home *** CD-ROM | disk | FTP | other *** search
/ PC Gamer (Italian) 30 / PC Gamer IT CD 30 1-2.iso / MOTS / GAMEDATA / RESOURCE / JKMRES.GOO / cog_pow_saber_m.cog < prev    next >
Text File  |  1998-02-25  |  2KB  |  91 lines

  1. # Jedi Knight Cog Script
  2. #
  3. # POW_SABER.COG
  4. #
  5. # POWERUP Script - Lightsaber pickup
  6. #
  7. # [YB & CYW]
  8. #
  9. # (C) 1997 LucasArts Entertainment Co. All Rights Reserved
  10.  
  11.  
  12. symbols
  13.  
  14. thing       powerup                          local
  15. thing       player                           local
  16. int         bin=11                           local
  17. sound       pickupsnd=thrmlpu2.wav           local
  18. sound       respawnsnd=Activate01.wav        local
  19. flex        amount                           local
  20.  
  21. int         autopickup=0                     local
  22.  
  23. message     touched
  24. message     taken
  25. message     respawn
  26.  
  27. end
  28.  
  29. # ========================================================================================
  30.  
  31. code
  32.  
  33. touched:
  34.    player = GetSourceRef();
  35.    if (GetWeaponBin(bin) != -1)
  36.    {
  37.       amount = GetInv(player, GetWeaponBin(bin));
  38.  
  39.       if (IsMulti() || (amount < GetInvMax(player, GetWeaponBin(bin))))
  40.       {
  41.          TakeItem(GetSenderRef(), -1);
  42.          call taken;
  43.       }
  44.    }
  45.  
  46.    Return;
  47.  
  48. # ........................................................................................
  49.  
  50. taken:
  51.    player = GetSourceRef();
  52.    powerup = GetSenderRef();
  53.  
  54.    if (GetWeaponBin(bin) != -1)
  55.    {
  56.       // Print("Lightsaber");
  57.       jkPrintUNIString(player, GetWeaponBin(bin));
  58.  
  59.       // Do effects.
  60.       PlaySoundLocal(pickupsnd, 1, 0, 0);
  61.       AddDynamicTint(player, 0.0, 0.0, 0.2);
  62.  
  63.       // Increment powerup amount.
  64.       SetInv(player, GetWeaponBin(bin), 1.0);
  65.  
  66.       // Check for Auto Pickup
  67.       autopickup = GetAutoPickup();
  68.       if(autopickup & 1)
  69.       {
  70.          if(!((autopickup & 4) && (GetWeaponPriority(player, GetWeaponBin(GetCurWeapon(player)), 0) >= GetWeaponPriority(player, bin, 0))))
  71.          {
  72.             if(!((autopickup & 8) && (GetWeaponBin(GetCurWeapon(player)) == jkGetMultiParam(1))))
  73.             {
  74.                SelectWeapon(player, bin);
  75.                Return;
  76.             }
  77.          }
  78.       }
  79.    }
  80.  
  81.    Return;
  82.  
  83. # ........................................................................................
  84.  
  85. respawn:
  86.    PlaySoundThingLocal(respawnsnd, GetSenderRef(), 0.6, 5.0, 10.0, 0);
  87.  
  88.    Return;
  89.  
  90. end
  91.